package com.x.erp.dao;

import com.x.erp.thirdparty.CarMappingXy;
import com.x.framework.dao.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * 与行圆车辆关系映射
 *
 */
@Repository
public class CarMappingXyDao extends BaseDao{
	
	private final static String selectXyCarSql = "SELECT T1.* FROM ERP_CAR_MAPPING_XY T1 WHERE 1=1 ";
	
	public List<CarMappingXy> selectXyCar(CarMappingXy carMappingXy) throws Exception{
		StringBuilder sb = new StringBuilder(selectXyCarSql);
		List<Object> params = new ArrayList<Object>();
		if(this.isString(carMappingXy.getCarId())){
			sb.append("AND T1.CAR_ID = ? ");
			params.add(carMappingXy.getCarId());
		}
		if(this.isNotNull(carMappingXy.getMappingCarId())){
			sb.append("AND T1.MAPPING_CAR_ID = ? ");
			params.add(carMappingXy.getMappingCarId());
		}
		return this.queryForList(sb.toString(), CarMappingXy.class, params);
	}

}
